using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Templates_Membership : BaseTemplate
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            flashHeader.Variables.Add("SiteRoot", this.GetSiteRoot());
        }

    }

    protected void userDetails_UserUpdating(object sender, Acms.AcmsControls.UserRegisterEventArgs e)
    {
        e.User.SetCustomProperty("Brand", txtBrand.Text);
        e.User.SetCustomProperty("OptOut", cbOptOutEdit.Checked.ToString());
    }

    protected void txtBrand_DataBinding(object sender, EventArgs e)
    {
        ((TextBox)sender).Text = User.Identity.User.GetCustomProperty("Brand");
    }

    protected void lblBrand_DataBinding(object sender, EventArgs e)
    {
        ((Label)sender).Text = User.Identity.User.GetCustomProperty("Brand");
    }

    protected void cbOptOut_DataBinding(object sender, EventArgs e)
    {
        string prop = User.Identity.User.GetCustomProperty("OptOut");
        if (prop != null)
        {
            try
            {
                ((CheckBox)sender).Checked = bool.Parse(prop);
            }
            catch (FormatException)
            {
            }
        }

    }
}
